Last updated: 2024-02-01

Checks: 7 0

Knit directory: UPF1-FMR1/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20230923) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 3265f59. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/
    Ignored:    analysis/Exploratory-DEG.nb.html
    Ignored:    analysis/Quality-control.nb.html

Untracked files:
    Untracked:  analysis/FMR1.Rmd
    Untracked:  data/data-stability-no-FMR1-no-UPF1.csv

Unstaged changes:
    Modified:   analysis/RNA-stability.Rmd
    Modified:   analysis/transcript-analysis.Rmd
    Modified:   output/DEG-results.Rda

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/DEG-analysis.Rmd) and HTML (docs/DEG-analysis.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 3265f59 urwahnawaz 2024-02-01 wflow_publish(c("analysis/DEG-analysis.Rmd", "analysis/index.Rmd"))
Rmd 3b20b67 urwahnawaz 2024-01-24 wflow_git_commit("./*")
html b6a1d60 urwahnawaz 2024-01-22 Build site.
html 98b3ae9 urwahnawaz 2024-01-18 Build site.
Rmd 4f57b71 urwahnawaz 2024-01-18 wflow_publish(c("analysis/index.Rmd", "analysis/DEG-analysis.Rmd"))
html 2b88aaf urwahnawaz 2024-01-17 Build site.
html 144afef urwahnawaz 2024-01-17 Build site.
Rmd 068b751 urwahnawaz 2024-01-17 wflow_git_commit("./*")
html facdd9d urwahnawaz 2024-01-17 Build site.
html 6cb16fa urwahnawaz 2024-01-17 Build site.
Rmd e0ee067 urwahnawaz 2024-01-17 wflow_publish("analysis/DEG-analysis.Rmd")
html 2b5790f urwahnawaz 2024-01-12 Build site.
Rmd bd34cfd urwahnawaz 2024-01-12 wflow_publish("analysis/DEG-analysis.Rmd")

Introduction

source(here::here("code/libraries.R"))
library(stargazer)
library(ggfortify)
library(glue)
library(cowplot)
library(broom)
library(glmpca)
library(naniar)
library(gridExtra)
library(EnsDb.Hsapiens.v86)
library(ggrepel)
library(org.Hs.eg.db)
library(msigdbr)
library(fgsea)

goSummaries <- url("https://uofabioinformaticshub.github.io/summaries2GO/data/goSummaries.RDS") %>%
    readRDS() %>%
    mutate(ontology = as.character(ontology))

getGeneLists <- function(pwf, goterms, genome, ids){
    gene2cat <- getgo(rownames(pwf), genome, ids)
    cat2gene <- split(rep(names(gene2cat), sapply(gene2cat, length)),
                      unlist(gene2cat, use.names = FALSE))
    out <- list()
    for(term in goterms){
        tmp <- pwf[cat2gene[[term]],]
        tmp <- rownames(tmp[tmp$DEgenes > 0, ])
        out[[term]] <- tmp
    }
    out


}
txdf = ensembldb::transcripts(EnsDb.Hsapiens.v86, return.type="DataFrame")
tx2gene = as.data.frame(txdf[,c("tx_id","gene_id", "tx_biotype")])
ah <- AnnotationHub() %>%
    subset(species == "Homo sapiens") %>%
    subset(rdataclass == "EnsDb") %>% 
  subset(genome == "GRCh38")

ensDb <- ah[["AH109606"]]
grTrans <- transcripts(ensDb)
trLengths <- exonsBy(ensDb, "tx") %>%
    width() %>%
    vapply(sum, integer(1))
mcols(grTrans)$length <- trLengths[names(grTrans)]

genesGR = ensembldb::genes(ensDb)
transGR = transcripts(ensDb)

mcols(transGR) = mcols(transGR) %>%
  cbind(
    transcriptLengths(ensDb)[rownames(.), c("nexon", "tx_len")]
  )


id2Name <- structure(
  genesGR$gene_name,
  names = genesGR$gene_id
) %>% 
  .[!duplicated(names(.))]
salmon.files = ("/home/neuro/Documents/NMD_analysis/Analysis/Results/UPF1-FMR1/Salmon")
salmon = list.files(salmon.files, pattern = "transcripts$", full.names = TRUE)
all_files = file.path(salmon, "quant.sf")
sample_names = gsub("/home/neuro/Documents/NMD_analysis/Analysis/Results/UPF1-FMR1/Salmon/", "", salmon)
sample_names = gsub(".gz_transcripts", "", sample_names)
sample_names = gsub("\\_.*", "", sample_names)
names(all_files) <- sample_names
md = read.csv(here::here("data/Sample_info.csv"), header= TRUE) %>%  
  #mutate(files = file.path(salmon, "quant.sf")) %>% 
  dplyr::rename("names" = "GeneWiz.ID", 
                "Group" = "Sample.type") %>% 
  mutate(Group = ifelse(Group == "MC" | Group == "FC", "Control", Group)) %>%
  dplyr::select(names,everything()) %>% 
  mutate(names = gsub("\\_.*", "", names) )
md = md[order(match(md$names, sample_names)),]
md %<>% 
  rownames_to_column("random") %>% 
#  column_to_rownames("names") %>%
  dplyr::select(-random) %>%
  mutate(files = all_files)

md %<>% dplyr::filter(Group != "FMR1") %>%
 dplyr::filter(names != "23-LDJ6767") %>%
dplyr::filter(names != "202")
all_files = all_files[names(all_files) %in% md$names]
txi_genes =  tximport(all_files, type="salmon", txOut=FALSE,
                      countsFromAbundance="scaledTPM", tx2gene = tx2gene, ignoreTxVersion = TRUE, ignoreAfterBar = TRUE)
keep.genes = (rowSums(txi_genes$abundance >= 1 ) >= 3)

Differential gene expression analysis

txi_genes_filtered = txi_genes$counts[keep.genes,]
y <- DGEList(txi_genes_filtered)


design <- model.matrix(~Batch +Group + Sex, data = md) %>% 
    set_colnames(gsub(pattern = "Group", replacement ="", x = colnames(.)))

y <- calcNormFactors(y)
v <- voom(y, design)

fit = lmFit(v, design) %>% 
    eBayes()
summary(decideTests(fit, lfc =0))
       (Intercept) Batch  FRAX  UPF1  SexM
Down           398   439   533   233    11
NotSig        2189 12093 11814 12551 13189
Up           10627   682   867   430    14

UPF1 DEGs

upf1_results_lfc = topTable(fit,coef = "UPF1", number = Inf) %>% 
                     mutate(res = ifelse(logFC > 0& adj.P.Val < 0.05, "Upregulated", 
                      ifelse(logFC < 0 & adj.P.Val < 0.05, "Downregulated", "NotSig"))) %>% 
  rownames_to_column("ensembl_gene_id") %>%
   mutate(SYMBOL = mapIds(org.Hs.eg.db, keys=ensembl_gene_id,  column="SYMBOL",keytype="ENSEMBL", multiVals="first")) %>%
  mutate(res = ifelse(logFC > 0 & adj.P.Val < 0.05, "Upregulated", 
                      ifelse(logFC < 0  & adj.P.Val < 0.05, "Downregulated", "NotSig")))
DEColours <- c("Downregulated" = "#2e294e","Upregulated" = "#720026",  "NotSig" = "#E5E5E5")


volc_upf1 = upf1_results_lfc  %>%
    ggplot(aes(y = -log10(adj.P.Val), 
               x =  logFC , 
               colour = res,
               size =-log10(adj.P.Val), 
               label= SYMBOL)) +
  geom_point(alpha = 0.8) +
  # geom_text(aes(label=ifelse(SYMBOL== "Upf1",as.character(SYMBOL),''))) +
  #  geom_text(aes(label= SYMBOL), subset = SYMBOL == "Upf1") +
    scale_colour_manual(values = DEColours) + theme_classic() + 
    theme(axis.title.y = element_text(size = 12)) +
    geom_hline(yintercept = -log10(0.05), color = "grey60", size = 0.5, lty = "dashed") +
    labs(x = "log2 Fold Change", y = "-log10 adj p-value") +
  geom_vline(xintercept = 0, size = 0.5, lty = "dashed", color = "grey60") +
  xlim(-8.5, 8.5) + ylim(0, 7.5)


# volc = volc_upf1+ geom_text_repel(data=subset(upf1_results_lfc , SYMBOL %in% c("UPF1", "UPF2", "UPF3B",
#                       "SMG5", "SMG6",
#                       "UPF3A", "ATF4", 
#                       "GADD5G")),
#             aes(label=SYMBOL),   position=position_dodge(width = 0.9), 
#              vjust=-0.40, color = "black", box.padding = 0.5, fill = "white") + ggtitle("DEGs in UPF1 relative to controls using limma/voom")
# 
# 
# volc 

my_gg = volc_upf1 + geom_point_interactive(aes(tooltip =SYMBOL, data_id = SYMBOL), 
    size = 1, hover_nearest = TRUE)
girafe(ggobj = my_gg)

Volcano plot showing distribution of differentially expressed genes using the limma/voom pipeline

upf1_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05) %>%
  dplyr::select(SYMBOL,ensembl_gene_id, logFC, adj.P.Val) %>% 
  dplyr::arrange(adj.P.Val) %>% 
  DT::datatable(caption="DEGS in UPF1 relative to controls using limma/voom pipeline") 
  • Gene ontology enrichment analysis

Gene tonic for visualisation

library(GeneTonic)
library(DESeq2)
library(AnnotationDbi)
library(pcaExplorer)
library(igraph)
library(visNetwork)
library(magrittr)
library(topGO)
tbledger <- as.data.frame(upf1_results_lfc)
colnames(tbledger)[colnames(tbledger) == "P.Value"] <- "pvalue"
colnames(tbledger)[colnames(tbledger) == "logFC"] <- "log2FoldChange"
colnames(tbledger)[colnames(tbledger) == "AveExpr"] <- "baseMean"
colnames(tbledger)[colnames(tbledger) == "SYMBOL"] <- "SYMBOL"
rownames(tbledger) =tbledger$ensembl_gene_id
tbledger$baseMean <- (2^tbledger$baseMean) * mean(y$samples$lib.size) / 1e6

edger_resu <- DESeqResults(DataFrame(tbledger))
edger_resu <- DESeq2:::pvalueAdjustment(edger_resu,
                                        independentFiltering = FALSE,
                                        alpha = FDR, pAdjustMethod = "BH")
anno_df <- data.frame(
  gene_id = upf1_results_lfc$ensembl_gene_id,
  gene_name = mapIds(org.Hs.eg.db, keys = upf1_results_lfc$ensembl_gene_id, column = "SYMBOL", keytype = "ENSEMBL"),
  stringsAsFactors = FALSE,
  row.names = upf1_results_lfc$ensembl_gene_id
)
sig_upf1 =upf1_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05) 

topgo_all_upf1_bp <-
  pcaExplorer::topGOtable(sig_upf1$SYMBOL,
                          upf1_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_upf1_bp <- shake_topGOtableResult(topgo_all_upf1_bp)

topgo_all_upf1_bp <- get_aggrscores(res_enrich = topgo_all_upf1_bp ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_upf1_bp,
                     edger_resu,
                     n_gs = 30,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
library(plotly)
p <- enhance_table(topgo_all_upf1_bp,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_upf1_bp,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • Upregulated genes
sig_upf1 =upf1_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05 & logFC > 0 ) 

topgo_all_upf1_bp <-
  pcaExplorer::topGOtable(sig_upf1$SYMBOL,
                          upf1_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500, 
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)

topgo_all_upf1_bp <- shake_topGOtableResult(topgo_all_upf1_bp)

topgo_all_upf1_bp  <- get_aggrscores(res_enrich = topgo_all_upf1_bp ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_upf1_bp,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_upf1_bp,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_upf1_bp,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • Downregulated genes
sig_upf1 =upf1_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05 & logFC < 0 ) 

topgo_all_upf1_bp <-
  pcaExplorer::topGOtable(sig_upf1$SYMBOL,
                          upf1_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500, 
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)

topgo_all_upf1_bp <- shake_topGOtableResult(topgo_all_upf1_bp)

topgo_all_upf1_bp  <- get_aggrscores(res_enrich = topgo_all_upf1_bp ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_upf1_bp,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_upf1_bp,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_upf1_bp,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])

FRAX DEGs

frax_results_lfc = topTable(fit,coef = "FRAX", number = Inf) %>% 
                     mutate(res = ifelse(logFC > 0  & adj.P.Val < 0.05, "Upregulated", 
                      ifelse(logFC < 0 & adj.P.Val < 0.05, "Downregulated", "NotSig"))) %>% 
  rownames_to_column("ensembl_gene_id") %>%
   mutate(SYMBOL = mapIds(org.Hs.eg.db, keys=ensembl_gene_id,  column="SYMBOL",keytype="ENSEMBL", multiVals="first")) %>% 
    mutate(res = ifelse(logFC > 0 & adj.P.Val < 0.05, "Upregulated", 
                      ifelse(logFC < 0  & adj.P.Val < 0.05, "Downregulated", "NotSig"))) 
save(frax_results_lfc,upf1_results_lfc, file = here::here("output/DEG-results.Rda"))
DEColours <- c("Downregulated" = "#2e294e","Upregulated" = "#720026",  "NotSig" = "#E5E5E5")


volc_frax = frax_results_lfc  %>%
    ggplot(aes(y = -log10(adj.P.Val), 
               x =  logFC , 
               colour = res,
               size =-log10(adj.P.Val), 
               label= SYMBOL)) +
  geom_point(alpha = 0.8) +
  # geom_text(aes(label=ifelse(SYMBOL== "Upf1",as.character(SYMBOL),''))) +
  #  geom_text(aes(label= SYMBOL), subset = SYMBOL == "Upf1") +
    scale_colour_manual(values = DEColours) + theme_classic() + 
    theme(axis.title.y = element_text(size = 12)) +
    geom_hline(yintercept = -log10(0.05), color = "grey60", size = 0.5, lty = "dashed") +
    labs(x = "log2 Fold Change", y = "-log10 adj p-value") +
  geom_vline(xintercept = 0, size = 0.5, lty = "dashed", color = "grey60") +
  xlim(-8.5, 8.5) + ylim(0, 7.5)


# volc = volc + geom_text_repel(data=subset(upf1_results_lfc , SYMBOL %in% c("UPF1", "UPF2", "UPF3B",
#                       "SMG5", "SMG6",
#                       "UPF3A", "ATF4", 
#                       "GADD5G", "FMR1")),
#             aes(label=SYMBOL),   position=position_dodge(width = 0.9), 
#              vjust=-0.40, color = "black", box.padding = 0.5, fill = "white") + ggtitle("DEGs in FRAX relative to controls using limma/voom pipeline")


my_gg =  volc_frax + geom_point_interactive(aes(tooltip =SYMBOL, data_id = SYMBOL), 
    size = 1, hover_nearest = TRUE)
girafe(ggobj = my_gg)

Enrichment analysis

tbledger <- as.data.frame(frax_results_lfc)
colnames(tbledger)[colnames(tbledger) == "P.Value"] <- "pvalue"
colnames(tbledger)[colnames(tbledger) == "logFC"] <- "log2FoldChange"
colnames(tbledger)[colnames(tbledger) == "AveExpr"] <- "baseMean"
colnames(tbledger)[colnames(tbledger) == "SYMBOL"] <- "SYMBOL"
rownames(tbledger) =tbledger$ensembl_gene_id
tbledger$baseMean <- (2^tbledger$baseMean) * mean(y$samples$lib.size) / 1e6

edger_resu <- DESeqResults(DataFrame(tbledger))
edger_resu <- DESeq2:::pvalueAdjustment(edger_resu,
                                        independentFiltering = FALSE,
                                        alpha = FDR, pAdjustMethod = "BH")
anno_df <- data.frame(
  gene_id = frax_results_lfc$ensembl_gene_id,
  gene_name = mapIds(org.Hs.eg.db, keys = frax_results_lfc$ensembl_gene_id, column = "SYMBOL", keytype = "ENSEMBL"),
  stringsAsFactors = FALSE,
  row.names = frax_results_lfc$ensembl_gene_id
)
sig_frax=frax_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05) 

topgo_all_frax <-
  pcaExplorer::topGOtable(sig_frax$SYMBOL,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 30,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
library(plotly)
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • Upregulated genes
sig_frax=frax_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05 & logFC > 0 ) 

topgo_all_frax <-
  pcaExplorer::topGOtable(sig_frax$SYMBOL,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • Downregulated genes
sig_frax=frax_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05 & logFC < 0 ) 

topgo_all_frax <-
  pcaExplorer::topGOtable(sig_frax$SYMBOL,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])

Overlap of UPF1 and FRAX

  • Number of genes overlapping
library(VennDiagram)
x= list("UPF1 DEGs" = upf1_results_lfc$SYMBOL[upf1_results_lfc$adj.P.Val < 0.05], 
        "FRAX DEGs" = frax_results_lfc$SYMBOL[frax_results_lfc$adj.P.Val < 0.05])

ggvenn(x)

overlaps = calculate.overlap(x)
upf1_only = overlaps$a1[!overlaps$a1 %in% overlaps$a3]
fmr1_only = overlaps$a2[!overlaps$a2 %in% overlaps$a3]
upf1_results_lfc %>% 
  dplyr::filter(adj.P.Val < 0.05) %>%
  dplyr::select(SYMBOL,ensembl_gene_id, logFC, adj.P.Val) %>% 
  inner_join(frax_results_lfc %>% 
               dplyr::filter(adj.P.Val < 0.05) %>%
                dplyr::select(ensembl_gene_id, FRAX.logFC=logFC, 
                              FRAX.padj =adj.P.Val), by = "ensembl_gene_id") %>% 
  ggscatter(., x="logFC", y = "FRAX.logFC", cor.coef = TRUE, add = "reg.line", 
              size=5, alpha =0.6, 
              conf.int = TRUE, add.params = list(color = "#EF3829",
                                                 fill = "lightgray")) + 
    theme_bw() + ylab("FRAX (log2FoldChange)") + xlab("UPF1 (log2FoldChange)") +
  geom_hline(yintercept = 0, size = 0.5,lty = "dashed", color = "grey60") +
  geom_vline(xintercept = 0, size = 0.5, lty = "dashed", color = "grey60") + ggtitle("Direction of expression of the 222 overlapping genes")
Overlap of significant genes from FRAX and UPF1

Overlap of significant genes from FRAX and UPF1

  • Gene ontology of overlapping genes
sig_genes =overlaps$a3

topgo_all_frax <-
  pcaExplorer::topGOtable(sig_genes,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)

graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • UPF1 specific genes
upf1_results_lfc %>% 
  dplyr::filter(SYMBOL %in% upf1_only) %>% 
  dplyr::select(SYMBOL,ensembl_gene_id, logFC, adj.P.Val) %>% 
  inner_join(frax_results_lfc %>% 
                dplyr::select(ensembl_gene_id, FRAX.logFC=logFC, 
                              FRAX.padj =adj.P.Val), by = "ensembl_gene_id") %>%
  ggscatter(., x="logFC", y = "FRAX.logFC", cor.coef = TRUE, add = "reg.line", 
              size=5, alpha =0.6, 
              conf.int = TRUE, add.params = list(color = "#EF3829",
                                                 fill = "lightgray")) + 
    theme_bw() + ylab("FRAX (log2FoldChange)") + xlab("UPF1 (log2FoldChange)") +
  geom_hline(yintercept = 0, size = 0.5,lty = "dashed", color = "grey60") +
  geom_vline(xintercept = 0, size = 0.5, lty = "dashed", color = "grey60") + ggtitle("Direction of expression of the 441 UPF1 specific genes")

topgo_all_frax <-
  pcaExplorer::topGOtable(upf1_only,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)
graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])
  • FRAX specific genes
frax_results_lfc %>% 
  dplyr::filter(SYMBOL %in% fmr1_only) %>% 
  dplyr::select(SYMBOL,ensembl_gene_id, FRAX.logFC=logFC, 
                              FRAX.padj =adj.P.Val) %>% 
  inner_join(upf1_results_lfc %>% 
                dplyr::select(ensembl_gene_id, logFC, 
                            adj.P.Val), by = "ensembl_gene_id") %>%
  ggscatter(., x="logFC", y = "FRAX.logFC", cor.coef = TRUE, add = "reg.line", 
              size=5, alpha =0.6, 
              conf.int = TRUE, add.params = list(color = "#EF3829",
                                                 fill = "lightgray")) + 
    theme_bw() + ylab("FRAX (log2FoldChange)") + xlab("UPF1 (log2FoldChange)") +
  geom_hline(yintercept = 0, size = 0.5,lty = "dashed", color = "grey60") +
  geom_vline(xintercept = 0, size = 0.5, lty = "dashed", color = "grey60") + ggtitle("Direction of expression of the 1178 FRAX specific genes")

topgo_all_frax <-
  pcaExplorer::topGOtable(fmr1_only,
                         frax_results_lfc$SYMBOL,
                          ontology = "BP",
                          mapping = "org.Hs.eg.db",
                          geneID = "symbol",
                          topTablerows = 500,
                          do_padj = TRUE) %>%
  as.data.frame() %>%
  mutate(Ont = "BP") %>%
  dplyr::filter(p.value_classic < 0.05)


topgo_all_frax<- shake_topGOtableResult(topgo_all_frax)

topgo_all_frax<- get_aggrscores(res_enrich = topgo_all_frax ,
                                        res_de = edger_resu,
                                        annotation_obj = anno_df,
                                        aggrfun = mean)
em <- enrichment_map(topgo_all_frax,
                     edger_resu,
                     n_gs = 50,
                     color_by = "z_score",
                     anno_df)
graph_vis = em %>% 
  visIgraph() %>% 
  visOptions(highlightNearest = list(enabled = TRUE,
                                     degree = 1,
                                     hover = TRUE),
             nodesIdSelection = TRUE)

graph_vis 
p <- enhance_table(topgo_all_frax,
                   edger_resu,
                   n_gs = 30,
                   annotation_obj = anno_df,
                   chars_limit = 60)
ggplotly(p)
distilled <- distill_enrichment(topgo_all_frax,
                                edger_resu,
                                anno_df,
                                n_gs = Inf,
                                cluster_fun = "cluster_markov")

DT::datatable(distilled$res_enrich[,])

Enrichment analysis with other NMD LCLs

Data export


sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

time zone: Australia/Adelaide
tzcode source: system (glibc)

attached base packages:
 [1] grid      stats4    tools     stats     graphics  grDevices utils    
 [8] datasets  methods   base     

other attached packages:
 [1] VennDiagram_1.7.3           futile.logger_1.4.3        
 [3] plotly_4.10.4               topGO_2.54.0               
 [5] SparseM_1.81                GO.db_3.18.0               
 [7] visNetwork_2.1.2            igraph_1.6.0               
 [9] pcaExplorer_2.28.0          GeneTonic_2.6.0            
[11] fgsea_1.28.0                msigdbr_7.5.1              
[13] org.Hs.eg.db_3.18.0         ggrepel_0.9.5              
[15] EnsDb.Hsapiens.v86_2.99.0   gridExtra_2.3              
[17] naniar_1.0.0                glmpca_0.2.0               
[19] broom_1.0.5                 cowplot_1.1.2              
[21] glue_1.7.0                  ggfortify_0.4.16           
[23] stargazer_5.2.3             ngsReports_2.4.0           
[25] patchwork_1.2.0             AnnotationHub_3.10.0       
[27] BiocFileCache_2.10.1        dbplyr_2.4.0               
[29] openxlsx_4.2.5.2            ggiraph_0.8.8              
[31] DT_0.31                     msigdb_1.10.0              
[33] GSEABase_1.64.0             graph_1.80.0               
[35] annotate_1.80.0             XML_3.99-0.16              
[37] pheatmap_1.0.12             ggvenn_0.1.10              
[39] MetBrewer_0.2.0             ggpubr_0.6.0               
[41] venn_1.12                   viridis_0.6.4              
[43] viridisLite_0.4.2           tximeta_1.20.2             
[45] tximport_1.30.0             goseq_1.54.0               
[47] geneLenDataBase_1.38.0      BiasedUrn_2.0.11           
[49] org.Mm.eg.db_3.18.0         EnsDb.Mmusculus.v79_2.99.0 
[51] ensembldb_2.26.0            AnnotationFilter_1.26.0    
[53] GenomicFeatures_1.54.1      AnnotationDbi_1.64.1       
[55] biomaRt_2.58.0              edgeR_4.0.11               
[57] limma_3.58.1                DESeq2_1.42.0              
[59] SummarizedExperiment_1.32.0 Biobase_2.62.0             
[61] MatrixGenerics_1.14.0       matrixStats_1.2.0          
[63] GenomicRanges_1.54.1        GenomeInfoDb_1.38.5        
[65] IRanges_2.36.0              S4Vectors_0.40.2           
[67] BiocGenerics_0.48.1         corrplot_0.92              
[69] lubridate_1.9.3             forcats_1.0.0              
[71] purrr_1.0.2                 readr_2.1.5                
[73] tidyverse_2.0.0             stringr_1.5.1              
[75] tidyr_1.3.0                 scales_1.3.0               
[77] data.table_1.14.10          readxl_1.4.3               
[79] tibble_3.2.1                magrittr_2.0.3             
[81] reshape2_1.4.4              ggplot2_3.4.4              
[83] dplyr_1.1.4                 workflowr_1.7.1            

loaded via a namespace (and not attached):
  [1] vroom_1.6.5                   progress_1.2.3               
  [3] Biostrings_2.70.1             vctrs_0.6.5                  
  [5] digest_0.6.34                 png_0.1-8                    
  [7] shape_1.4.6                   shinyBS_0.61.1               
  [9] registry_0.5-1                git2r_0.33.0                 
 [11] MASS_7.3-60.0.1               httpuv_1.6.13                
 [13] foreach_1.5.2                 withr_3.0.0                  
 [15] xfun_0.41                     ellipsis_0.3.2               
 [17] survival_3.5-7                memoise_2.0.1                
 [19] systemfonts_1.0.5             zoo_1.8-12                   
 [21] GlobalOptions_0.1.2           prettyunits_1.2.0            
 [23] KEGGREST_1.42.0               promises_1.2.1               
 [25] httr_1.4.7                    rstatix_0.7.2                
 [27] restfulr_0.0.15               ps_1.7.6                     
 [29] rstudioapi_0.15.0             shinyAce_0.4.2               
 [31] miniUI_0.1.1.1                generics_0.1.3               
 [33] base64enc_0.1-3               processx_3.8.3               
 [35] babelgene_22.9                curl_5.2.0                   
 [37] zlibbioc_1.48.0               ca_0.71.1                    
 [39] polyclip_1.10-6               GenomeInfoDbData_1.2.11      
 [41] SparseArray_1.2.3             RBGL_1.78.0                  
 [43] threejs_0.3.3                 interactiveDisplayBase_1.40.0
 [45] xtable_1.8-4                  doParallel_1.0.17            
 [47] evaluate_0.23                 S4Arrays_1.2.0               
 [49] hms_1.1.3                     colorspace_2.1-0             
 [51] filelock_1.0.3                Rgraphviz_2.46.0             
 [53] shinyWidgets_0.8.1            later_1.3.2                  
 [55] lattice_0.22-5                NMF_0.26                     
 [57] genefilter_1.84.0             getPass_0.2-4                
 [59] pillar_1.9.0                  nlme_3.1-164                 
 [61] iterators_1.0.14              gridBase_0.4-7               
 [63] compiler_4.3.2                stringi_1.8.3                
 [65] shinycssloaders_1.0.0         Category_2.68.0              
 [67] TSP_1.2-4                     dendextend_1.17.1            
 [69] GenomicAlignments_1.38.2      plyr_1.8.9                   
 [71] crayon_1.5.2                  abind_1.4-5                  
 [73] BiocIO_1.12.0                 ggdendro_0.1.23              
 [75] locfit_1.5-9.8                bit_4.0.5                    
 [77] fastmatch_1.1-4               whisker_0.4.1                
 [79] codetools_0.2-19              crosstalk_1.2.1              
 [81] bslib_0.6.1                   GetoptLong_1.0.5             
 [83] mime_0.12                     splines_4.3.2                
 [85] circlize_0.4.15               Rcpp_1.0.12                  
 [87] tippy_0.1.0                   cellranger_1.1.0             
 [89] knitr_1.45                    blob_1.2.4                   
 [91] utf8_1.2.4                    here_1.0.1                   
 [93] clue_0.3-65                   BiocVersion_3.18.1           
 [95] fs_1.6.3                      backbone_2.1.2               
 [97] admisc_0.34                   expm_0.999-9                 
 [99] ggsignif_0.6.4                Matrix_1.6-5                 
[101] callr_3.7.3                   statmod_1.5.0                
[103] tzdb_0.4.0                    visdat_0.6.0                 
[105] tweenr_2.0.2                  pkgconfig_2.0.3              
[107] cachem_1.0.8                  RSQLite_2.3.5                
[109] DBI_1.2.1                     fastmap_1.1.1                
[111] rmarkdown_2.25                shinydashboard_0.7.2         
[113] Rsamtools_2.18.0              sass_0.4.8                   
[115] BiocManager_1.30.22           carData_3.0-5                
[117] farver_2.1.1                  mgcv_1.9-1                   
[119] AnnotationForge_1.44.0        yaml_2.3.8                   
[121] rtracklayer_1.62.0            cli_3.6.2                    
[123] webshot_0.5.5                 lifecycle_1.0.4              
[125] lambda.r_1.2.4                backports_1.4.1              
[127] rintrojs_0.3.4                BiocParallel_1.36.0          
[129] timechange_0.3.0              gtable_0.3.4                 
[131] rjson_0.2.21                  ggridges_0.5.5               
[133] parallel_4.3.2                jsonlite_1.8.8               
[135] colourpicker_1.3.0            seriation_1.5.4              
[137] bitops_1.0-7                  assertthat_0.2.1             
[139] bit64_4.0.5                   zip_2.3.0                    
[141] heatmaply_1.5.0               bs4Dash_2.3.0                
[143] futile.options_1.0.1          highr_0.10                   
[145] jquerylib_0.1.4               lazyeval_0.2.2               
[147] pander_0.6.5                  shiny_1.8.0                  
[149] dynamicTreeCut_1.63-1         htmltools_0.5.7              
[151] formatR_1.14                  rappdirs_0.3.3               
[153] XVector_0.42.0                RCurl_1.98-1.14              
[155] rprojroot_2.0.4               ComplexUpset_1.3.3           
[157] R6_2.5.1                      labeling_0.4.3               
[159] cluster_2.1.6                 rngtools_1.5.2               
[161] DelayedArray_0.28.0           tidyselect_1.2.0             
[163] ProtGenerics_1.34.0           GOstats_2.68.0               
[165] ggforce_0.4.1                 xml2_1.3.6                   
[167] car_3.1-2                     munsell_0.5.0                
[169] htmlwidgets_1.6.4             ComplexHeatmap_2.18.0        
[171] RColorBrewer_1.1-3            rlang_1.1.3                  
[173] uuid_1.2-0                    fansi_1.0.6